package org.example.minebackend.controller;

import lombok.extern.slf4j.Slf4j;
import org.example.minebackend.pojo.LoginUser;
import org.example.minebackend.pojo.Result;
import org.example.minebackend.pojo.User;
import org.example.minebackend.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@CrossOrigin("*")
@RestController
@Slf4j
public class LoginController {
    @Autowired
    private LoginService loginService;
    @PostMapping("/login/user")
    public Result userLogin(@RequestBody LoginUser loginUser) {
        User user = loginService.userLogin(loginUser);
        if (user == null) {
            return Result.error("error");
        }
        return Result.success(user);
    }
}
